function game(playAction) {
    const arr = ['rock', 'scissor', 'paper']
    const random = Math.random() * 3
    const index = Math.floor(random)
    const computerAction = arr[index]
    console.log('我出了：', computerAction);
    

    if (playAction === computerAction) {
        console.log('平局');
        return 0
        
    }else if ((playAction === 'rock' && computerAction === 'scissor') || (playAction === 'scissor' && computerAction === 'paper') || (playAction === 'paper' && computerAction === 'rock')) {
        console.log('你赢了');
        return 1
    }else {
        console.log('你输了');
        return -1
    }

}

module.exports = {
    game
}